package mware_lib.namensdienst.communication;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
	private ServerSocket MySvrSocket;
	private Socket sock;

	public Server(int listenPort) throws IOException{
		MySvrSocket = new ServerSocket(listenPort);     
		this.sock = null;
		System.out.println("Server am Start!");
	}

	public ObjectConnection getConnection() throws IOException {
		sock = MySvrSocket.accept();
		//System.out.println("Client connected");
		return new ObjectConnection(sock);
	}

	public void shutdown() throws IOException {
		MySvrSocket.close();
	}

}

